package com.geek.ch03.game;

import java.util.concurrent.TimeUnit;

/**
 * @desc TODO
 * @author chenmin
 * @date   2025/9/3
 */
public class Test {
    public static void main(String[] args) {
        Hero hero = new Hero("瞎子" , 18 , 1500 ,"人类" , 180 , 50);
        Monster monster = new Monster("狗熊" , 18 , 2000 , "兽类" , 120 , 180);

        Equip equip1 = new Equip("渴血战斧" , 6 , "红色" , "斧类" , 20 , 0);
        Equip equip2 = new Equip("焚天" , 7 , "棕色" , "枪类" , 20 , 20);
        Equip equip3 = new Equip("黑切" , 6 , "黑色" , "斧类" , 15 , 0);
        Equip equip4 = new Equip("青龙刀" , 3 , "绿色" , "刀类" , 20 , 0);
        System.out.println("英雄装备了："+equip1.getName()+","+equip2.getName()+","+equip3.getName());
        hero.addEquip(equip1);
        hero.addEquip(equip2);
        hero.addEquip(equip3);
        hero.addEquip(equip4);

        hero.show();
        System.out.println("----------------");
        monster.show();

        //回合制攻击
        int count = 0;
        while (true){
            System.out.println("----------- 第"+(++count)+"轮攻击------------");

            hero.attack(monster);
            if (monster.isDead()) {
                System.out.println("怪兽死亡 ， Game  Over");
                System.exit(0);
            }
            //沉睡
            try {
                TimeUnit.SECONDS.sleep(1);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }

            monster.attack(hero);
            if(hero.isDead()){
                System.out.println("英雄死亡 ， Game  Over");
                System.exit(0);
            }
            //沉睡
            try {
                TimeUnit.SECONDS.sleep(1);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    }

}
